package cn.cvs.redis1demo.controller;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class SessionController {
    @Value("${server.port}")
    private String port;


    @GetMapping("/session")
    public Map getSession(HttpServletRequest request){
        Map map=new HashMap();
        map.put("port",port);
        map.put("sessionId",request.getSession().getId());
        return map;
    }
}
